package com.zhang.gateway.remote;


import com.zhang.gateway.remote.fallback.AuthRemoteFallback;
import com.zhang.infrastructure.api.model.authority.*;
import com.zhang.infrastructure.model.KingHoodResponseVO;
import com.zhang.infrastructure.model.constant.ServerNameConstant;
import com.zhang.infrastructure.model.token.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * description
 *
 * @author zhangFanJun
 * @date 2023-12-07 9:47
 **/
@FeignClient(value = ServerNameConstant.AUTHORITY_CENTER, path = "/authorityCenter/auth",fallback = AuthRemoteFallback.class)
//@ReactiveFeignClient(value = ServerNameConstant.AUTHORITY_CENTER, path = "/authorityCenter/oauth")
public interface AuthRemote {

    /**
     * 获取token
     * */
    @PostMapping("/openToken")
    KingHoodResponseVO openToken(@RequestBody TokenReqDTO in);

    /**
     * token检查
     * */
    @PostMapping("/checkToken")
    KingHoodResponseVO<Boolean> validateToken(@RequestBody CheckTokenReqDTO in);

    /**
     * 获取用户信息
     * 请求头携带token
     * */
    @PostMapping("/userDetail")
    KingHoodResponseVO<UserDTO> userDetail();

    /**
     * 获取用户信息和权限
     * 请求头携带token
     * */
    @PostMapping("/user")
    KingHoodResponseVO<UserResDTO> user();

    /**
     * 获取用户信息和权限
     * 请求头不携带token
     * */
    @PostMapping("/getUser")
    //    Mono<KingHoodResponseVO<UserResDTO>> user(@RequestBody Mono<UserReqDTO> in);
    KingHoodResponseVO<UserResDTO> getUser(@RequestBody GetUserReqDTO in);

}
